package com.xunyji.xunyjitest.web;

import com.xunyji.xunyjitest.comm.util.BaiduTransApi;
import com.xunyji.xunyjitest.config.baidu.BaiduBaseConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;

/**
 * @author AltEnter
 * @create 2019-01-09 22:14
 * @desc 测试类
 **/
@Slf4j
@Component
public class TestDemo {

    @Autowired
    private BaiduBaseConfig baiduBaseConfig;

    @Autowired
    private BaiduTransApi baiduTransApi;

    public void baiduBaseConfigTest() {
        log.info("读取到的百度翻译相关的配置信息为：" + baiduBaseConfig);
    }

    public void baiduTransApiTest() throws UnsupportedEncodingException {
        String transStrResult = baiduTransApi.getTransStrResult("我来自重庆", "auto", "en");
        log.info("翻译响应的结果为：" + transStrResult);
    }

    public static void main(String[] args) {

    }
}

